

#ifndef _DDSafeDelete_
#define _DDSafeDelete_

#define MySafeDelete(x)     if(NULL != x){           \
                                       delete x;     \
                                       x = NULL;}

#define MySafeDeleteMAB(x)  if(NULL != x){           \
                                       delete[] x;   \
                                       x = NULL;}

#define MySafeRelease(x)    if(NULL != x){           \
                                       x->Release();  \
                                       x = NULL;}

#define MySafeCloseHandle(x) if(NULL != x){            \
                                       CloseHandle(x);  \
                                       x = NULL;}

#ifndef MySafeFreeLib
#define MySafeFreeLib(x) if( NULL != x ){ FreeLibrary(x); x = NULL;}
#endif

#endif
